//
//  ResultView.m
//  Weiweiyunshi
//
//  Created by 王译 on 17/2/5.
//  Copyright © 2017年 王译. All rights reserved.
//

#import "ResultView.h"

@implementation ResultView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self createView];
    }
    return self;
}

-(void)createView{
    
    self.backgroundColor = [UIColor colorWithRed:239 green:239 blue:244];
    
    _backView = [[UIView alloc]init];
    _imgView = [[UIImageView alloc]init];
    _nameLabel = [[UILabel alloc]init];
    _mobileLabel = [[UILabel alloc]init];
    _emailLabel = [[UILabel alloc]init];
    _addButton = [[UIButton alloc]init];
    
    NSArray *arr = @[_imgView,_nameLabel,_mobileLabel,_emailLabel];
    [self addSubview:_backView];
    _backView.sd_layout
    .widthRatioToView(self,1)
    .heightIs(130)
    .topSpaceToView(self,114);
    [_backView sd_addSubviews:arr];
    _backView.backgroundColor = [UIColor whiteColor];
    
    [self addSubview:_addButton];
    _addButton.sd_layout
    .widthRatioToView(self,0.8)
    .centerXEqualToView(self)
    .topSpaceToView(_backView,50)
    .heightIs(60);
    [_addButton setTitle:@"添加到好友" forState:UIControlStateNormal];
    _addButton.backgroundColor = [UIColor colorWithRed:83 green:215 blue:105];
    _addButton.sd_cornerRadius = @4;
    _imgView.sd_layout
    .topSpaceToView(_backView,30)
    .leftSpaceToView(_backView,30)
    .widthIs(80)
    .heightEqualToWidth();
    
    _imgView.sd_cornerRadius = @4;
    //_imgView.backgroundColor = RAN_COLOR
    
    _nameLabel.sd_layout
    .topEqualToView(_imgView)
    .leftSpaceToView(_imgView,10)
    .widthIs(80)
    .heightRatioToView(_imgView,0.3);
   // _nameLabel.backgroundColor = RAN_COLOR
    
    _mobileLabel.sd_layout
    .topSpaceToView(_nameLabel,5)
    .leftEqualToView(_nameLabel)
    .widthIs(120)
    .heightRatioToView(_imgView,0.3);
  //  _mobileLabel.backgroundColor = RAN_COLOR
    
    _emailLabel.sd_layout
    .topSpaceToView(_mobileLabel,5)
    .leftEqualToView(_nameLabel)
    .widthIs(300)
    .heightRatioToView(_imgView,0.3);
    //_emailLabel.backgroundColor = RAN_COLOR
    
    self.userInteractionEnabled = YES;
}

@end
